﻿using System.Linq;
using System.Security.Principal;

namespace BLL.Model.Base
{
    public class UserPrincipal : IPrincipal  
    {
        public LoginUserInfo UserInfo { get; private set; }

        public UserPrincipal(LoginUserInfo user)
        {
            UserInfo = user;
        }  

        public bool IsInRole(string role)
        {
            return UserInfo.Roles.Contains(role);
        }

        public IIdentity Identity
        {
            get
            {
                return new UserIdentity(UserInfo);
            }
        }
    }
}